#ifndef _INET_ADDRESS_H_
#define _INET_ADDRESS_H_

#include <string>   // 放在名空间外，否则可能会导致标准库代码被错误地嵌套在命名空间中，引发命名冲突
#include <sys/socket.h>
#include <netinet/in.h>

namespace xy
{
    class InetAddress
    {
    public:
        InetAddress(unsigned short, const std::string&);
        InetAddress(const struct sockaddr_in &);
        ~InetAddress() = default;
        
        std::string get_ip() const;
        unsigned short get_port() const;
        struct sockaddr_in* get_InetAddress();

    private:
        struct sockaddr_in _addr;   // netinet/in.h
    };
}

#endif

